﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using Bussines;
using Bussines.Utils;
using Entities;

namespace Business
{
    public class NguoiDungService:Service<NguoiDung>
    {
        public int checkLogin(NguoiDung nsd)
        {
            NguoiDung nsdDT = Select("tendangnhap", nsd.Tendangnhap)[0];
            if (nsdDT == null)
                return Constants.LOGIN_USER_NOT_EXIST;
            else if (nsdDT.Matkhau != nsd.Matkhau)
                return Constants.LOGIN_PASSWORD_MISMATCH;
            HttpContext.Current.Session["NguoiDung"] = nsdDT;
            return Constants.LOGIN_SUCCESS;
        }
    }
}
